/**
 * Licensee: Universidad de La Frontera
 * License Type: Academic
 */
package ormsamples;

import org.orm.*;
public class CreateTallerAplicado1RegistroDeCuentasData {
	public void createTestData() throws PersistentException {
		PersistentTransaction t = orm.TallerAplicado1RegistroDeCuentasPersistentManager.instance().getSession().beginTransaction();
		try {
			//orm.Cliente lormCliente = orm.ClienteDAO.createCliente();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : cuenta, cliente_historico, token
			//orm.ClienteDAO.save(lormCliente);
			//orm.Cliente_historico lormCliente_historico = orm.Cliente_historicoDAO.createCliente_historico();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : cliente, token
			//orm.Cliente_historicoDAO.save(lormCliente_historico);
			//orm.Consumo lormConsumo = orm.ConsumoDAO.createConsumo();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : token, cuenta
			//orm.ConsumoDAO.save(lormConsumo);
			
			orm.Servicio lormServicio = orm.ServicioDAO.createServicio();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : cuenta, tipo_servicio
			lormServicio.setTipo_servicio("gas");
			lormServicio.setValor_unitario(12);
			lormServicio.setValor_fijo(12);
			System.out.println("successssss");
			orm.ServicioDAO.save(lormServicio);
			//orm.Login lormLogin = orm.LoginDAO.createLogin();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : consumo, cliente, cuenta, cliente_historico, usuario
			//orm.LoginDAO.save(lormLogin);
			
			//orm.Administrador lormAdministrador = orm.AdministradorDAO.createAdministrador();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : login
			//lormAdministrador.setUsuario("admin");
			//lormAdministrador.setClave("admin");
			//orm.AdministradorDAO.save(lormAdministrador);
			
			//orm.Cuenta lormCuenta = orm.CuentaDAO.createCuenta();
			// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : consumo, cliente, servicio, token
			//orm.CuentaDAO.save(lormCuenta);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			CreateTallerAplicado1RegistroDeCuentasData createTallerAplicado1RegistroDeCuentasData = new CreateTallerAplicado1RegistroDeCuentasData();
			try {
				createTallerAplicado1RegistroDeCuentasData.createTestData();
			}
			finally {
				orm.TallerAplicado1RegistroDeCuentasPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
